//
//  NewClubCell.m
//  Shengzhuli
//
//  Created by FXGuo on 2018/1/9.
//  Copyright © 2018年 kamangkeji. All rights reserved.
//

#import "NewClubCell.h"

@interface NewClubCell()
@property (weak, nonatomic) IBOutlet UIImageView *img;
@property (weak, nonatomic) IBOutlet UILabel *clubNameLab;
@property (weak, nonatomic) IBOutlet UILabel *desLab;
@property (weak, nonatomic) IBOutlet UILabel *focusLab;
@property (weak, nonatomic) IBOutlet UILabel *funsLab;
@property (weak, nonatomic) IBOutlet UIButton *focusBtn;

@end

@implementation NewClubCell

- (void)awakeFromNib {
    [super awakeFromNib];
    if (ScreenH == 568.00) {
        self.clubNameLab.font = Font(13);
        self.desLab.font = Font(13);
    }
}
- (void)setImgStr:(NSString *)imgStr
{
    _imgStr = imgStr;
//    [self.img sd_setImageWithURL:[NSURL URLWithString:imgStr] placeholderImage:GetImage(@"default_large_goods_image")];
}

- (void)setModel:(ClubModel *)model
{
    _model = model;
    self.clubNameLab.text = model.clubName;
    self.desLab.text = model.content;
    [self.img sd_setImageWithURL:[NSURL URLWithString:model.clubLogo] placeholderImage:GetImage(@"default_large_goods_image")];
    if (model.keepStatus == 0) {//0未关注 1关注
        [self.focusBtn setTitleColor:[UIColor colorWithHexString:@"#3285ff"] forState:UIControlStateNormal];
        [self.focusBtn setTitle:@"关注" forState:UIControlStateNormal];
    }else {
        [self.focusBtn setTitleColor:[UIColor colorWithHexString:@"#888888"] forState:UIControlStateNormal];
        [self.focusBtn setTitle:@"已关注" forState:UIControlStateNormal];
    }
    NSInteger count = [NSString stringWithFormat:@"%zd",model.keepCount].length;
    NSString *str = [NSString stringWithFormat:@"%zd关注",model.keepCount];
    NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc]initWithString:str];
    [attrStr addAttributes:@{NSFontAttributeName:Font(11),NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#3285ff"]} range:NSMakeRange(0, count)];
    [attrStr addAttributes:@{NSFontAttributeName:Font(11),NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#888888"]} range:NSMakeRange(count, str.length-count)];
    self.focusLab.attributedText = attrStr;
    
    NSInteger count2 = [NSString stringWithFormat:@"%zd",model.fans].length;
    NSString *str2 = [NSString stringWithFormat:@"%zd粉丝",model.fans];
    NSMutableAttributedString *attrStr2 = [[NSMutableAttributedString alloc]initWithString:str2];
    [attrStr2 addAttributes:@{NSFontAttributeName:Font(11),NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#3285ff"]} range:NSMakeRange(0, count2)];
    [attrStr2 addAttributes:@{NSFontAttributeName:Font(11),NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#888888"]} range:NSMakeRange(count2, str2.length-count2)];
    self.funsLab.attributedText = attrStr2;
    
}
- (IBAction)focusClick:(UIButton *)btn
{
    if (self.focusClick) {
        self.focusClick(self.model);
    }
}

@end
